﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.LongER.Framework.Utils;
using Com.LongER.UI;
using Com.LongER.Business.ZBH002;
using Com.LongER.Framework.Utils.LogUtils;

public partial class ZBH002 : ABasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            //画面ID
            Label lblPageId = (Label)Master.FindControl("lblPageId");
            lblPageId.Text = "ZBH002";

            //画面处理名
            Label lblPageName = (Label)Master.FindControl("lblPageName");
            lblPageName.Text = "订单详细管理画面";

            //清空画面中的输入框
            #region
            proc清空_Init("0");
            #endregion
        }

        //autocomplete
        this.txt客户.Text = this.hid客户.Value;
        this.txt品名.Text = this.hid品名.Value;
        this.txt所用车型.Text = this.hid所用车型.Value;
        this.txt计量单位.Text = this.hid计量单位.Value;
        this.txt结算方式.Text = this.hid结算方式.Value;
        this.txt订单状态.Text = this.hid订单状态.Value;
        this.txt起点省市.Text = this.hid起点省市.Value;
        this.txt装货地.Text = this.hid装货地.Value;
        this.txt终点省市.Text = this.hid终点省市.Value;
        this.txt卸货地.Text = this.hid卸货地.Value;
    }

    protected void btn客户查询_Click(object sender, EventArgs e)
    {

    }

    //protected void btn付款方式查询_Click(object sender, EventArgs e)
    //{

    //}

    protected void btn联系人查询_Click(object sender, EventArgs e)
    {

    }

    protected void btn品名查询_Click(object sender, EventArgs e)
    {

    }

    protected void btn装货地查询_Click(object sender, EventArgs e)
    {

    }

    protected void btn执行_Click(object sender, EventArgs e)
    {
        //初期化处理
        #region
        //错误信息
        Label lblMsgCD = (Label)Master.FindControl("lblMsgCD");
        Label lblMsg = (Label)Master.FindControl("lblMsg");
        lblMsgCD.Text = "";
        lblMsg.Text = "";

        #endregion

        //处理区分进行确认
        if (this.txt处理区分.Text == string.Empty) //处理区分为空的场合
        {
            this.SetMessage("GTH000", "IGTH000001", MSG_LEVEL.Info);
            this.AddCssClass(this.txt处理区分, CSS_TEXT_ERROR);
            return;
        }
        else if (this.txt处理区分.Text == "1") //处理区分为1(查询)的场合
        {
            #region
            //查询时，各个控件的属性进行控制
            //proc清空_Init(this.txt处理区分.Text);

            //订单号为空时
            if (this.txt订单号.Text == string.Empty)
            {
                this.SetMessage("GTH002", "IGTH002002", MSG_LEVEL.Error);
                this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                return;
            }

            //通过订单号进行查询
            CZBH002 instance = new CZBH002();
            ZBH002DS.T_ORDERDataTable dt = instance.GetTOrderDetail(this.txt订单号.Text);
            if (dt.Count <= 0)
            {
                //查询失败
                this.SetMessage("GTH002", "IGTH002001", MSG_LEVEL.Error);
                this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                this.txt订单号.Focus();
                return;
            }
            else
            {
                this.SetMessage("GTH002", "IGTH002000", MSG_LEVEL.Info);

                //各个项目传值
                #region
                //装卸货时间
                this.txt装货时间_Day.Text = dt[0].ZHUANGHUO_DATE.ToString();
                this.txt装货时间_Hour.Text = dt[0].ZHUANGHUO_TIME.ToString();
                this.txt卸货时间_Day.Text = dt[0].XIEHUO_DATE.ToString();
                this.txt卸货时间_Hour.Text = dt[0].XIEHUO_TIME.ToString();

                //客户信息
                this.txt客户CD.Text = dt[0].AGENT.ToString();
                this.txt客户.Text = dt[0].K_KEHU_HANZI.ToString();
                //this.txt付款方式CD.Text = dt[0].JIESUAN_TYPE.ToString();
                //this.txt付款方式.Text = dt[0].JSFS_HANZI.ToString();
                //this.txt客户联系人CD.Text = dt[0].K_LIANXI_REN.ToString();
                this.txt客户联系人.Text = dt[0].K_LIANXI_REN.ToString();
                this.txt客户电话.Text = dt[0].K_TEL_NUM1.ToString();
                this.txt客户FAX.Text = dt[0].K_FAX1.ToString();
                this.txt客户详细地址.Text = dt[0].K_GONGSI_ADDR.ToString();

                //品名信息
                this.txt品名CD.Text = dt[0].PINMING_CD.ToString();
                this.txt品名.Text = dt[0].PINMING_CD.ToString();
                this.txt所用车型CD.Text = dt[0].CHELIANG_XINGTAI.ToString();
                this.txt所用车型.Text = dt[0].CLXT_HANZI.ToString();
                this.txt长.Text = dt[0].LENGTH.ToString();
                this.txt宽.Text = dt[0].WIDTH.ToString();
                this.txt重量.Text = dt[0].WEIGHT.ToString();
                this.txt数量.Text = dt[0].COUNTS.ToString();
                this.txt计量单位CD.Text = dt[0].DANWEI_CD.ToString();
                this.txt计量单位.Text = dt[0].DANWEI.ToString();

                //订单信息
                this.txt承运费.Text = dt[0].CHENGYUN_COSTS.ToString();
                this.txt结算方式CD.Text = dt[0].JIESUAN_TYPE.ToString();
                this.txt结算方式.Text = dt[0].JSFS_HANZI.ToString();
                this.txt押运单编号.Text = dt[0].AGENTNO.ToString();
                this.txt订单状态CD.Text = dt[0].ORDER_STATUS.ToString();
                this.txt订单状态.Text = dt[0].DDZT_HANZI.ToString();

                //装货地信息
                this.txt起点省市CD.Text = dt[0].ZHUANGHUO_SHENGSHI.ToString();
                this.txt起点省市.Text = dt[0].Q_SENS_HANZI.ToString();
                this.txt装货地CD.Text = dt[0].ZHUANGHUO.ToString();
                this.txt装货地.Text = dt[0].ZHUANGHUO_LUOCHENG.ToString();
                this.txt装货地联系人.Text = dt[0].ZHUANGHUO_LIANXI_REN.ToString();
                this.txt装货地电话.Text = dt[0].ZHUANGHUO_LIANXI_TEL.ToString();
                this.txt装货地FAX.Text = dt[0].ZHUANGHUO_LIANXI_FAX.ToString();
                this.txt装货地详细地址.Text = dt[0].ZHUANGHUO_LIANXI_ADDR.ToString();

                //卸货地信息
                this.txt终点省市CD.Text = dt[0].XIEHUO_SHENGSHI.ToString();
                this.txt终点省市.Text = dt[0].Z_SENS_HANZI.ToString();
                this.txt卸货地CD.Text = dt[0].XIEHUO.ToString();
                this.txt卸货地.Text = dt[0].XIEHUO_LUOCHENG.ToString();
                this.txt卸货地联系人.Text = dt[0].XIEHUO_LIANXI_REN.ToString();
                this.txt卸货地电话.Text = dt[0].XIEHUO_LIANXI_TEL.ToString();
                this.txt卸货地FAX.Text = dt[0].XIEHUO_LIANXI_FAX.ToString();
                this.txt卸货地详细地址.Text = dt[0].XIEHUO_LIANXI_ADDR.ToString();

                this.txt备注.Text = dt[0].BEIZHU.ToString();
                #endregion
                this.txt订单号.Focus();
            }
            #endregion

        }
        else if (this.txt处理区分.Text == "2") //处理区分为2(登记)的场合
        {
            //登录时，各个控件的属性进行控制
            proc清空_Init(this.txt处理区分.Text);

            #region
            //登记时，各个控件的值进行检查

            //订单号的值进行检查
            #region
            if (this.txt订单号.Text.Trim() == string.Empty)
            {
                //订单号为空的场合,退出登陆
                this.SetMessage("ZBH002", "IZBH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                return;
            }
            else
            {
                //对订单号进行查询
                CZBH002 instanceSelectMChe = new CZBH002();
                ZBH002DS.T_ORDERDataTable dtSelectMChe = instanceSelectMChe.GetTOrderDetail(this.txt订单号.Text);
                if (dtSelectMChe.Count > 0)
                {
                    //订单号已存在场合,退出登陆
                    this.SetMessage("ZBH002", "IZBH002006", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                    this.txt订单号.Focus();
                    return;
                }
            }
            #endregion

            //客户进行检查？？？
            #region
            //车主的值空的场合，退出登陆
            //if (this.txt车主CD.Text.Trim() == string.Empty)
            //{
            //    this.SetMessage("ZBH002", "IZBH002000", MSG_LEVEL.Error);
            //    this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
            //    this.txt车主CD.Focus();
            //    return;
            //}
            //else
            //{
            //    //对车主进行查询
            //    CZBH002 instanceSelectChezhu = new CZBH002();
            //    ZBH002DS.M_KEHUDataTable dtSelectChezhu = instanceSelectChezhu.GetCheZhuDetail(this.txt车主CD.Text);
            //    if (dtSelectChezhu.Count <= 0)
            //    {
            //        //车主在客户表中不存在的场合，退出登陆
            //        this.SetMessage("ZBH002", "IZBH002001", MSG_LEVEL.Error);
            //        this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
            //        this.txt车主CD.Focus();
            //        return;
            //    }
            //    else
            //    {
            //        this.txt车主.Text = dtSelectChezhu[0].KEHU_HANZI.ToString();
            //        this.txt车主联系电话1.Text = dtSelectChezhu[0].TEL_NUM1.ToString();
            //        this.txt车主联系电话2.Text = dtSelectChezhu[0].TEL_NUM2.ToString();
            //        this.txt车主传真号.Text = dtSelectChezhu[0].FAX1.ToString();
            //        this.txt车主邮箱.Text = dtSelectChezhu[0].MAIL_ADDR.ToString();
            //    }
            //}
            #endregion

            //发货地进行检查？？？？
            #region
            //主驾驶员的值空的场合
            //if (this.txt主驾驶员CD.Text.Trim() == string.Empty)
            //{
            //    this.SetMessage("ZBH002", "IZBH002002", MSG_LEVEL.Error);
            //    this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
            //    this.txt主驾驶员CD.Focus();
            //    return;
            //}
            //else
            //{
            //    //对主驾驶员进行查询
            //    CZBH002 instanceSelectStaff = new CZBH002();
            //    ZBH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt主驾驶员CD.Text);
            //    if (dtSelectStaff.Count <= 0)
            //    {
            //        //主驾驶员在员工表中不存在的场合，退出登陆
            //        this.SetMessage("ZBH002", "IZBH002003", MSG_LEVEL.Error);
            //        this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
            //        this.txt主驾驶员CD.Focus();
            //        return;
            //    }
            //    else
            //    {
            //        this.txt主驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
            //        this.txt主驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
            //        this.txt主驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
            //        this.txt主驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
            //    }
            //}
            #endregion

            //送货地进行检查?????
            #region
            //副驾驶员的值空的场合
            //if (this.txt副驾驶员CD.Text.Trim() == string.Empty)
            //{
            //    this.SetMessage("ZBH002", "IZBH002004", MSG_LEVEL.Error);
            //    this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
            //    this.txt副驾驶员CD.Focus();
            //    return;
            //}
            //else
            //{
            //    //对副驾驶员进行查询
            //    CZBH002 instanceSelectStaff = new CZBH002();
            //    ZBH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt副驾驶员CD.Text);
            //    if (dtSelectStaff.Count <= 0)
            //    {
            //        //副驾驶员在员工表中不存在的场合，退出登陆
            //        this.SetMessage("ZBH002", "IZBH002005", MSG_LEVEL.Error);
            //        this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
            //        this.txt副驾驶员CD.Focus();
            //        return;
            //    }
            //    else
            //    {
            //        this.txt副驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
            //        this.txt副驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
            //        this.txt副驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
            //        this.txt副驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
            //    }
            //}
            #endregion

            //执行登记
            #region
            LoginInfo LoginInfo = (LoginInfo)Session["LoginInfo"];

            Boolean isInserted = false;
            CZBH002 instance = new CZBH002();
            isInserted = instance.InsertT_ORDER(this.txt订单号.Text, this.txt品名CD.Text,
                                      decimal.Parse( this.txt长.Text), decimal.Parse( this.txt宽.Text), decimal.Parse( this.txt高.Text),  decimal.Parse( this.txt重量.Text),
                                      decimal.Parse(this.txt数量.Text), this.txt计量单位CD.Text,
                                       this.txt所用车型CD.Text,
                                       this.txt装货时间_Day.Text, this.txt装货时间_Hour.Text,
                                       this.txt卸货时间_Day.Text, this.txt卸货时间_Hour.Text,
                                       this.txt客户CD.Text, this.txt装货地CD.Text, this.txt卸货地CD.Text,
                                       decimal.Parse(this.txt承运费.Text), this.txt结算方式CD.Text,
                                       this.txt押运单编号.Text, this.txt订单状态CD.Text, "00",  LoginInfo.USERID,
                                       this.txt备注.Text);
            if (!isInserted)
            {
                //登记失败
                this.SetMessage("GTH003", "IGTH003002", MSG_LEVEL.Error);
                this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                this.txt订单号.Focus();
            }
            else
            {
                //登记成功
                this.SetMessage("GTH003", "IGTH003000", MSG_LEVEL.Info);
                this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                this.txt订单号.Focus();
            }
            #endregion

            #endregion
        }
        else if (this.txt处理区分.Text == "3") //处理区分为1(订正)的场合
        {
            #region
            //订正时，各个控件的属性进行控制
            proc清空_Init(this.txt处理区分.Text);


            //订单号的值进行检查
            #region
            if (this.txt订单号.Text.Trim() == string.Empty)
            {
                //订单号为空的场合,退出登陆
                this.SetMessage("ZBH002", "IZBH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                return;
            }
            else
            {
                //对订单号进行查询
                CZBH002 instanceSelectMChe = new CZBH002();
                ZBH002DS.T_ORDERDataTable dtSelectMChe = instanceSelectMChe.GetTOrderDetail(this.txt订单号.Text);
                if (dtSelectMChe.Count <= 0)
                {
                    //订单号不存在场合,退出登陆
                    this.SetMessage("ZBH002", "IZBH002007", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                    this.txt订单号.Focus();
                    return;
                }
            }
            #endregion

            //车主的值进行检查
            #region
            //车主的值空的场合，退出登陆
            //if (this.txt车主CD.Text.Trim() == string.Empty)
            //{
            //    this.SetMessage("ZBH002", "IZBH002000", MSG_LEVEL.Error);
            //    this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
            //    this.txt车主CD.Focus();
            //    return;
            //}
            //else
            //{
            //    //对车主进行查询
            //    CZBH002 instanceSelectChezhu = new CZBH002();
            //    ZBH002DS.M_KEHUDataTable dtSelectChezhu = instanceSelectChezhu.GetCheZhuDetail(this.txt车主CD.Text);
            //    if (dtSelectChezhu.Count <= 0)
            //    {
            //        //车主在客户表中不存在的场合，退出登陆
            //        this.SetMessage("ZBH002", "IZBH002001", MSG_LEVEL.Error);
            //        this.AddCssClass(this.txt车主CD, CSS_TEXT_ERROR);
            //        this.txt车主CD.Focus();
            //        return;
            //    }
            //    else
            //    {
            //        this.txt车主.Text = dtSelectChezhu[0].KEHU_HANZI.ToString();
            //        this.txt车主联系电话1.Text = dtSelectChezhu[0].TEL_NUM1.ToString();
            //        this.txt车主联系电话2.Text = dtSelectChezhu[0].TEL_NUM2.ToString();
            //        this.txt车主传真号.Text = dtSelectChezhu[0].FAX1.ToString();
            //        this.txt车主邮箱.Text = dtSelectChezhu[0].MAIL_ADDR.ToString();
            //    }
            //}
            #endregion

            //主驾驶员的值进行检查
            #region
            //主驾驶员的值空的场合
            //if (this.txt主驾驶员CD.Text.Trim() == string.Empty)
            //{
            //    this.SetMessage("ZBH002", "IZBH002002", MSG_LEVEL.Error);
            //    this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
            //    this.txt主驾驶员CD.Focus();
            //    return;
            //}
            //else
            //{
            //    //对主驾驶员进行查询
            //    CZBH002 instanceSelectStaff = new CZBH002();
            //    ZBH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt主驾驶员CD.Text);
            //    if (dtSelectStaff.Count <= 0)
            //    {
            //        //主驾驶员在员工表中不存在的场合，退出登陆
            //        this.SetMessage("ZBH002", "IZBH002003", MSG_LEVEL.Error);
            //        this.AddCssClass(this.txt主驾驶员CD, CSS_TEXT_ERROR);
            //        this.txt主驾驶员CD.Focus();
            //        return;
            //    }
            //    else
            //    {
            //        this.txt主驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
            //        this.txt主驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
            //        this.txt主驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
            //        this.txt主驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
            //    }
            //}
            #endregion

            //副驾驶员的值进行检查
            #region
            //副驾驶员的值空的场合
            //if (this.txt副驾驶员CD.Text.Trim() == string.Empty)
            //{
            //    this.SetMessage("ZBH002", "IZBH002004", MSG_LEVEL.Error);
            //    this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
            //    this.txt副驾驶员CD.Focus();
            //    return;
            //}
            //else
            //{
            //    //对副驾驶员进行查询
            //    CZBH002 instanceSelectStaff = new CZBH002();
            //    ZBH002DS.M_STAFFDataTable dtSelectStaff = instanceSelectStaff.GetJiaShiYuanDetail(this.txt副驾驶员CD.Text);
            //    if (dtSelectStaff.Count <= 0)
            //    {
            //        //副驾驶员在员工表中不存在的场合，退出登陆
            //        this.SetMessage("ZBH002", "IZBH002005", MSG_LEVEL.Error);
            //        this.AddCssClass(this.txt副驾驶员CD, CSS_TEXT_ERROR);
            //        this.txt副驾驶员CD.Focus();
            //        return;
            //    }
            //    else
            //    {
            //        this.txt副驾驶员.Text = dtSelectStaff[0].STAFF_HANZI.ToString();
            //        this.txt副驾驶员联系电话.Text = dtSelectStaff[0].MOBIL1.ToString();
            //        this.txt副驾驶员驾龄.Text = dtSelectStaff[0].JIALING.ToString();
            //        this.txt副驾驶员准驾类型.Text = dtSelectStaff[0].JIAZHAO_TYPE.ToString();
            //    }
            //}
            #endregion

            //执行更新
            #region
            LoginInfo LoginInfo = (LoginInfo)Session["LoginInfo"];

            Boolean isChanged = false;
            CZBH002 instance = new CZBH002();
            isChanged = instance.UpdateT_Order(this.txt品名CD.Text,
                                      decimal.Parse( this.txt长.Text), decimal.Parse( this.txt宽.Text), decimal.Parse( this.txt高.Text),  decimal.Parse( this.txt重量.Text),
                                      decimal.Parse(this.txt数量.Text), this.txt计量单位CD.Text,
                                       this.txt所用车型CD.Text,
                                       this.txt装货时间_Day.Text, this.txt装货时间_Hour.Text,
                                       this.txt卸货时间_Day.Text, this.txt卸货时间_Hour.Text,
                                       this.txt客户CD.Text, this.txt装货地CD.Text, this.txt卸货地CD.Text,
                                       decimal.Parse(this.txt承运费.Text), this.txt结算方式CD.Text,
                                       this.txt押运单编号.Text, this.txt订单状态CD.Text, "00",  LoginInfo.USERID,
                                       this.txt备注.Text,
                                       this.txt订单号.Text);
            if (!isChanged)
            {
                //更新失败
                String msg = MessageUtil.GetMessage("GTH001", "IGTH001002");
                lblMsgCD.Text = "IGTH001002";
                lblMsg.Text = msg;
                this.txt处理区分.Focus();
            }
            else
            {
                //更新成功
                String msg = MessageUtil.GetMessage("GTH001", "IGTH001000");
                lblMsgCD.Text = "IGTH001000";
                lblMsg.Text = msg;
                this.txt处理区分.Focus();
            }
            #endregion

            #endregion
        }
        else if (this.txt处理区分.Text == "9") //处理区分为1(删除)的场合
        {
            #region
            //删除时，各个控件的属性进行控制
            //proc清空_Init(this.txt处理区分.Text);

            //订单号的值进行检查
            #region
            if (this.txt订单号.Text.Trim() == string.Empty)
            {
                //订单号为空的场合,退出登陆
                this.SetMessage("ZBH002", "IZBH002000", MSG_LEVEL.Error);
                this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                return;
            }
            else
            {
                //对订单号进行查询
                CZBH002 instanceSelectMChe = new CZBH002();
                ZBH002DS.T_ORDERDataTable dtSelectMChe = instanceSelectMChe.GetTOrderDetail(this.txt订单号.Text);
                if (dtSelectMChe.Count <= 0)
                {
                    //订单号已存在场合,退出登陆
                    this.SetMessage("ZBH002", "IZBH002006", MSG_LEVEL.Error);
                    this.AddCssClass(this.txt订单号, CSS_TEXT_ERROR);
                    this.txt订单号.Focus();
                    return;
                }
            }
            #endregion

            //执行删除
            Boolean isDeleted = false;
            CZBH002 instance = new CZBH002();
            isDeleted = instance.DeleteT_Order(this.txt订单号.Text);
            if (!isDeleted)
            {
                //删除失败
                String msg = MessageUtil.GetMessage("GTH004", "IGTH004002");
                lblMsgCD.Text = "IGTH004002";
                lblMsg.Text = msg;
                this.txt订单号.Focus();
            }
            else
            {
                //删除成功
                String msg = MessageUtil.GetMessage("GTH004", "IGTH004000");
                lblMsgCD.Text = "IGTH004000";
                lblMsg.Text = msg;
                this.txt订单号.Focus();
            }

            #endregion
        }
        else //处理区分为上述以外的场合
        {
            String msg = MessageUtil.GetMessage("GTH000", "IGTH000002");
            lblMsgCD.Text = "IGTH000002";
            lblMsg.Text = msg;
            return;
        }

    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn主菜单_Click(object sender, EventArgs e)
    {
        Response.Redirect("/LongER/ZAH003.aspx");
    }


    protected void proc清空_Init(string str处理区分)
    {
        Label lblMsgCD = (Label)Master.FindControl("lblMsgCD");
        Label lblMsg = (Label)Master.FindControl("lblMsg");
        lblMsgCD.Text = "";
        lblMsg.Text = "";

        //初期化
        if (str处理区分 == "0")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            //订单号
            this.txt订单号.Enabled = true;

            //装卸货时间
            this.txt装货时间_Day.Enabled = false;
            this.txt装货时间_Hour.Enabled = false;
            this.txt卸货时间_Day.Enabled = false;
            this.txt卸货时间_Hour.Enabled = false;

            //客户信息
            this.txt客户CD.Enabled = false;
            this.txt客户.Enabled = false;
            //this.txt付款方式CD.Enabled = false;
            //this.txt付款方式.Enabled = false;
            //this.txt客户联系人CD.Enabled = false;
            this.txt客户联系人.Enabled = false;
            this.txt客户电话.Enabled = false;
            this.txt客户FAX.Enabled = false;
            this.txt客户详细地址.Enabled = false;

            //品名信息
            this.txt品名CD.Enabled = false;
            this.txt品名.Enabled = false;
            this.txt所用车型CD.Enabled = false;
            this.txt所用车型.Enabled = false;
            this.txt长.Enabled = false;
            this.txt宽.Enabled = false;
            this.txt重量.Enabled = false;
            this.txt数量.Enabled = false;
            this.txt计量单位CD.Enabled = false;
            this.txt计量单位.Enabled = false;

            //订单信息
            this.txt承运费.Enabled = false;
            this.txt结算方式CD.Enabled = false;
            this.txt结算方式.Enabled = false;
            this.txt押运单编号.Enabled = false;
            this.txt订单状态CD.Enabled = false;
            this.txt订单状态.Enabled = false;

            //装货地信息
            this.txt起点省市CD.Enabled = false;
            this.txt起点省市.Enabled = false;
            this.txt装货地CD.Enabled = false;
            this.txt装货地.Enabled = false;
            this.txt装货地联系人.Enabled = false;
            this.txt装货地电话.Enabled = false;
            this.txt装货地FAX.Enabled = false;
            this.txt装货地详细地址.Enabled = false;

            //卸货地信息
            this.txt终点省市CD.Enabled = false;
            this.txt终点省市.Enabled = false;
            this.txt卸货地CD.Enabled = false;
            this.txt卸货地.Enabled = false;
            this.txt卸货地联系人.Enabled = false;
            this.txt卸货地电话.Enabled = false;
            this.txt卸货地FAX.Enabled = false;
            this.txt卸货地详细地址.Enabled = false;


            this.txt备注.Enabled = false;
            #endregion

            //控件的Text进行清空
            #region
            this.txt处理区分.Text = string.Empty;
            this.txt处理区分.Focus();

            //订单号
            this.txt订单号.Text = string.Empty;

            //装卸货时间
            this.txt装货时间_Day.Text = string.Empty;
            this.txt装货时间_Hour.Text = string.Empty;
            this.txt卸货时间_Day.Text = string.Empty;
            this.txt卸货时间_Hour.Text = string.Empty;

            //客户信息
            this.txt客户CD.Text = string.Empty;
            this.txt客户.Text = string.Empty;
            //this.txt付款方式CD.Text = string.Empty;
            //this.txt付款方式.Text = string.Empty;
            //this.txt客户联系人CD.Text = string.Empty;
            this.txt客户联系人.Text = string.Empty;
            this.txt客户电话.Text = string.Empty;
            this.txt客户FAX.Text = string.Empty;
            this.txt客户详细地址.Text = string.Empty;

            //品名信息
            this.txt品名CD.Text = string.Empty;
            this.txt品名.Text = string.Empty;
            this.txt所用车型CD.Text = string.Empty;
            this.txt所用车型.Text = string.Empty;
            this.txt长.Text = string.Empty;
            this.txt宽.Text = string.Empty;
            this.txt重量.Text = string.Empty;
            this.txt数量.Text = string.Empty;
            this.txt计量单位CD.Text = string.Empty;
            this.txt计量单位.Text = string.Empty;

            //订单信息
            this.txt承运费.Text = string.Empty;
            this.txt结算方式CD.Text = string.Empty;
            this.txt结算方式.Text = string.Empty;
            this.txt押运单编号.Text = string.Empty;
            this.txt订单状态CD.Text = string.Empty;
            this.txt订单状态.Text = string.Empty;

            //装货地信息
            this.txt起点省市CD.Text = string.Empty;
            this.txt起点省市.Text = string.Empty;
            this.txt装货地CD.Text = string.Empty;
            this.txt装货地.Text = string.Empty;
            this.txt装货地联系人.Text = string.Empty;
            this.txt装货地电话.Text = string.Empty;
            this.txt装货地FAX.Text = string.Empty;
            this.txt装货地详细地址.Text = string.Empty;

            //卸货地信息
            this.txt终点省市CD.Text = string.Empty;
            this.txt终点省市.Text = string.Empty;
            this.txt卸货地CD.Text = string.Empty;
            this.txt卸货地.Text = string.Empty;
            this.txt卸货地联系人.Text = string.Empty;
            this.txt卸货地电话.Text = string.Empty;
            this.txt卸货地FAX.Text = string.Empty;
            this.txt卸货地详细地址.Text = string.Empty;
            this.txt备注.Text = string.Empty;
            #endregion
        }

        //查询
        if (str处理区分 == "1")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            //订单号
            this.txt订单号.Enabled = true;

            //装卸货时间
            this.txt装货时间_Day.Enabled = false;
            this.txt装货时间_Hour.Enabled = false;
            this.txt卸货时间_Day.Enabled = false;
            this.txt卸货时间_Hour.Enabled = false;

            //客户信息
            this.txt客户CD.Enabled = false;
            this.txt客户.Enabled = false;
            //this.txt付款方式CD.Enabled = false;
            //this.txt付款方式.Enabled = false;
            //this.txt客户联系人CD.Enabled = false;
            this.txt客户联系人.Enabled = false;
            this.txt客户电话.Enabled = false;
            this.txt客户FAX.Enabled = false;
            this.txt客户详细地址.Enabled = false;

            //品名信息
            this.txt品名CD.Enabled = false;
            this.txt品名.Enabled = false;
            this.txt所用车型CD.Enabled = false;
            this.txt所用车型.Enabled = false;
            this.txt长.Enabled = false;
            this.txt宽.Enabled = false;
            this.txt重量.Enabled = false;
            this.txt数量.Enabled = false;
            this.txt计量单位CD.Enabled = false;
            this.txt计量单位.Enabled = false;

            //订单信息
            this.txt承运费.Enabled = false;
            this.txt结算方式CD.Enabled = false;
            this.txt结算方式.Enabled = false;
            this.txt押运单编号.Enabled = false;
            this.txt订单状态CD.Enabled = false;
            this.txt订单状态.Enabled = false;

            //装货地信息
            this.txt起点省市CD.Enabled = false;
            this.txt起点省市.Enabled = false;
            this.txt装货地CD.Enabled = false;
            this.txt装货地.Enabled = false;
            this.txt装货地联系人.Enabled = false;
            this.txt装货地电话.Enabled = false;
            this.txt装货地FAX.Enabled = false;
            this.txt装货地详细地址.Enabled = false;

            //卸货地信息
            this.txt终点省市CD.Enabled = false;
            this.txt终点省市.Enabled = false;
            this.txt卸货地CD.Enabled = false;
            this.txt卸货地.Enabled = false;
            this.txt卸货地联系人.Enabled = false;
            this.txt卸货地电话.Enabled = false;
            this.txt卸货地FAX.Enabled = false;
            this.txt卸货地详细地址.Enabled = false;


            this.txt备注.Enabled = false;
            #endregion

            //控件的Text进行清空
            #region
            this.txt处理区分.Focus();

            //订单号
            //this.txt订单号.Text = string.Empty;

            //装卸货时间
            this.txt装货时间_Day.Text = string.Empty;
            this.txt装货时间_Hour.Text = string.Empty;
            this.txt卸货时间_Day.Text = string.Empty;
            this.txt卸货时间_Hour.Text = string.Empty;

            //客户信息
            this.txt客户CD.Text = string.Empty;
            this.txt客户.Text = string.Empty;
            //this.txt付款方式CD.Text = string.Empty;
            //this.txt付款方式.Text = string.Empty;
            //this.txt客户联系人CD.Text = string.Empty;
            this.txt客户联系人.Text = string.Empty;
            this.txt客户电话.Text = string.Empty;
            this.txt客户FAX.Text = string.Empty;
            this.txt客户详细地址.Text = string.Empty;

            //品名信息
            this.txt品名CD.Text = string.Empty;
            this.txt品名.Text = string.Empty;
            this.txt所用车型CD.Text = string.Empty;
            this.txt所用车型.Text = string.Empty;
            this.txt长.Text = string.Empty;
            this.txt宽.Text = string.Empty;
            this.txt重量.Text = string.Empty;
            this.txt数量.Text = string.Empty;
            this.txt计量单位CD.Text = string.Empty;
            this.txt计量单位.Text = string.Empty;

            //订单信息
            this.txt承运费.Text = string.Empty;
            this.txt结算方式CD.Text = string.Empty;
            this.txt结算方式.Text = string.Empty;
            this.txt押运单编号.Text = string.Empty;
            this.txt订单状态CD.Text = string.Empty;
            this.txt订单状态.Text = string.Empty;

            //装货地信息
            this.txt起点省市CD.Text = string.Empty;
            this.txt起点省市.Text = string.Empty;
            this.txt装货地CD.Text = string.Empty;
            this.txt装货地.Text = string.Empty;
            this.txt装货地联系人.Text = string.Empty;
            this.txt装货地电话.Text = string.Empty;
            this.txt装货地FAX.Text = string.Empty;
            this.txt装货地详细地址.Text = string.Empty;

            //卸货地信息
            this.txt终点省市CD.Text = string.Empty;
            this.txt终点省市.Text = string.Empty;
            this.txt卸货地CD.Text = string.Empty;
            this.txt卸货地.Text = string.Empty;
            this.txt卸货地联系人.Text = string.Empty;
            this.txt卸货地电话.Text = string.Empty;
            this.txt卸货地FAX.Text = string.Empty;
            this.txt卸货地详细地址.Text = string.Empty;
            this.txt备注.Text = string.Empty;
            #endregion
        }

        //登记或订正
        if (str处理区分 == "2" || str处理区分 == "3")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            //订单号
            this.txt订单号.Enabled = true;

            //装卸货时间
            this.txt装货时间_Day.Enabled = true;
            this.txt装货时间_Hour.Enabled = true;
            this.txt卸货时间_Day.Enabled = true;
            this.txt卸货时间_Hour.Enabled = true;

            //客户信息
            this.txt客户CD.Enabled = true;
            this.txt客户.Enabled = false;
            //this.txt付款方式CD.Enabled = false;
            //this.txt付款方式.Enabled = false;
            //this.txt客户联系人CD.Enabled = false;
            this.txt客户联系人.Enabled = false;
            this.txt客户电话.Enabled = false;
            this.txt客户FAX.Enabled = false;
            this.txt客户详细地址.Enabled = false;

            //品名信息
            this.txt品名CD.Enabled = true;
            this.txt品名.Enabled = false;
            this.txt所用车型CD.Enabled = true;
            this.txt所用车型.Enabled = false;
            this.txt长.Enabled = true;
            this.txt宽.Enabled = true;
            this.txt重量.Enabled = true;
            this.txt数量.Enabled = true;
            this.txt计量单位CD.Enabled = true;
            this.txt计量单位.Enabled = false;

            //订单信息
            this.txt承运费.Enabled = true;
            this.txt结算方式CD.Enabled = true;
            this.txt结算方式.Enabled = false;
            this.txt押运单编号.Enabled = true;
            this.txt订单状态CD.Enabled = true;
            this.txt订单状态.Enabled = false;

            //装货地信息
            this.txt起点省市CD.Enabled = true;
            this.txt起点省市.Enabled = false;
            this.txt装货地CD.Enabled = true;
            this.txt装货地.Enabled = false;
            this.txt装货地联系人.Enabled = false;
            this.txt装货地电话.Enabled = false;
            this.txt装货地FAX.Enabled = false;
            this.txt装货地详细地址.Enabled = false;

            //卸货地信息
            this.txt终点省市CD.Enabled = true;
            this.txt终点省市.Enabled = true;
            this.txt卸货地CD.Enabled = false;
            this.txt卸货地.Enabled = false;
            this.txt卸货地联系人.Enabled = false;
            this.txt卸货地电话.Enabled = false;
            this.txt卸货地FAX.Enabled = false;
            this.txt卸货地详细地址.Enabled = false;


            this.txt备注.Enabled = true;
            #endregion

            //控件的Text进行清空
            #region

            #endregion
        }

        //删除
        if (str处理区分 == "9")
        {
            //控件的Enabled进行控制
            #region
            this.txt处理区分.Enabled = true;

            //订单号
            this.txt订单号.Enabled = true;

            //装卸货时间
            this.txt装货时间_Day.Enabled = false;
            this.txt装货时间_Hour.Enabled = false;
            this.txt卸货时间_Day.Enabled = false;
            this.txt卸货时间_Hour.Enabled = false;

            //客户信息
            this.txt客户CD.Enabled = false;
            this.txt客户.Enabled = false;
            //this.txt付款方式CD.Enabled = false;
            //this.txt付款方式.Enabled = false;
            //this.txt客户联系人CD.Enabled = false;
            this.txt客户联系人.Enabled = false;
            this.txt客户电话.Enabled = false;
            this.txt客户FAX.Enabled = false;
            this.txt客户详细地址.Enabled = false;

            //品名信息
            this.txt品名CD.Enabled = false;
            this.txt品名.Enabled = false;
            this.txt所用车型CD.Enabled = false;
            this.txt所用车型.Enabled = false;
            this.txt长.Enabled = false;
            this.txt宽.Enabled = false;
            this.txt重量.Enabled = false;
            this.txt数量.Enabled = false;
            this.txt计量单位CD.Enabled = false;
            this.txt计量单位.Enabled = false;

            //订单信息
            this.txt承运费.Enabled = false;
            this.txt结算方式CD.Enabled = false;
            this.txt结算方式.Enabled = false;
            this.txt押运单编号.Enabled = false;
            this.txt订单状态CD.Enabled = false;
            this.txt订单状态.Enabled = false;

            //装货地信息
            this.txt起点省市CD.Enabled = false;
            this.txt起点省市.Enabled = false;
            this.txt装货地CD.Enabled = false;
            this.txt装货地.Enabled = false;
            this.txt装货地联系人.Enabled = false;
            this.txt装货地电话.Enabled = false;
            this.txt装货地FAX.Enabled = false;
            this.txt装货地详细地址.Enabled = false;

            //卸货地信息
            this.txt终点省市CD.Enabled = false;
            this.txt终点省市.Enabled = false;
            this.txt卸货地CD.Enabled = false;
            this.txt卸货地.Enabled = false;
            this.txt卸货地联系人.Enabled = false;
            this.txt卸货地电话.Enabled = false;
            this.txt卸货地FAX.Enabled = false;
            this.txt卸货地详细地址.Enabled = false;


            this.txt备注.Enabled = false;
            #endregion

            //控件的Text不进行清空
            #region

            #endregion
        }
    }

    protected void txt处理区分_TextChange(object sender, EventArgs e)
    {
        Label lblMsgCD = (Label)Master.FindControl("lblMsgCD");
        Label lblMsg = (Label)Master.FindControl("lblMsg");

        //处理区分为空的场合
        if (this.txt处理区分.Text == string.Empty)
        {
            String msg = MessageUtil.GetMessage("GTH000", "IGTH000001");
            lblMsgCD.Text = "IGTH000001";
            lblMsg.Text = msg;
            return;
        }
        //处理区分为1,2,3,9的场合
        else if (this.txt处理区分.Text == "1" || this.txt处理区分.Text == "2" ||
            this.txt处理区分.Text == "3" || this.txt处理区分.Text == "9")
        {
            this.proc清空_Init(this.txt处理区分.Text);
        }
        //处理区分为上述以外的场合
        else
        {
            String msg = MessageUtil.GetMessage("GTH000", "IGTH000002");
            lblMsgCD.Text = "IGTH000002";
            lblMsg.Text = msg;
            return;
        }

    }

    protected void btn清除_Click(object sender, EventArgs e)
    {
        //初期化处理
        #region
        //查询时，各个控件的属性进行控制
        proc清空_Init("0");
        #endregion
    }


}